package com.rongcheng.forfeature.actions;

import com.rongcheng.forfeature.dispatcher.Dispatcher;

/**
 * Created by frc on 16-10-31.
 */

public class ActionCreator {
    private static ActionCreator instance;
    final Dispatcher dispatcher;

    ActionCreator(Dispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    public static ActionCreator get(Dispatcher dispatcher) {
        if (instance == null) {
            instance = new ActionCreator(dispatcher);
        }
        return instance;
    }

    public void sendMessage(String message) {
        dispatcher.dispatch(new MessageAction(MessageAction.ACTION_NEW_MESSAGE, message));
    }
}
